TOOLPATH = z_tools/
INCPATH  = z_tools/haribote/

MAKE     = $(TOOLPATH)make.exe -r
EDIMG    = $(TOOLPATH)edimg.exe
IMGTOL   = $(TOOLPATH)imgtol.com
COPY     = copy
DEL      = del.bat
bin      = bin/
os		 = os/

# 默认行为

default : os.cll app.ccl 
	$(MAKE) haribote.img

os.ccl :
	$(MAKE) -C os

app.ccl : 
	$(MAKE) -C app

lib.ccl :
	$(MAKE) -C include
	
haribote.img : os.ccl app.ccl Makefile
	$(EDIMG)   imgin:z_tools/fdimg0at.tek \
		wbinimg src:$(bin)ipl20.bin len:512 from:0 to:0 \
		copy from:$(bin)haribote.sys to:@: \
		copy from:$(bin)color.hrb to:@: \
		copy from:$(bin)hello2.hrb to:@: \
		copy from:$(bin)hello5.hrb to:@: \
		copy from:$(bin)a.hrb to:@: \
		copy from:$(bin)crack1.hrb to:@: \
		copy from:$(bin)crack7.hrb to:@: \
		copy from:$(bin)bug1.hrb to:@: \
		copy from:$(bin)winhello.hrb to:@: \
		copy from:$(bin)lines.hrb to:@: \
		copy from:$(bin)walk.hrb to:@: \
		copy from:$(bin)noodle.hrb to:@: \
		copy from:$(bin)sosu.hrb to:@: \
		copy from:$(bin)read.hrb to:@: \
		copy from:$(os)ipl20.nas to:@: \
		copy from:$(bin)iroha.hrb to:@: \
		copy from:txt/euc.txt to:@: \
		copy from:language/nihongo/nihongo.fnt to:@: \
		copy from:language/chinese/hzk16.fnt to:@: \
		imgout:$(bin)haribote.img

runw :
	$(MAKE) haribote.img
	copy-sys haribote.img D:\qemu\fdimage0.bin
	$(MAKE) -C D:\qemu
	
w10:
	copy-sys haribote.img ..\z_tools\qemu\fdimage0.bin
	$(MAKE) -C D:\qemu

runx :
	$(MAKE) haribote.img
	copy-sys haribote.img ..\z_tools\qemu\fdimage0.bin
	$(MAKE) -C z_tools/qemu
	
xp:
	copy-sys haribote.img ..\z_tools\qemu\fdimage0.bin
	$(MAKE) -C z_tools/qemu
	

install :
	$(MAKE) img
	$(IMGTOL) w a: haribote.img

clear :
	$(DEL) /S /Q bin
	make -C include clear
	make -C app clear